package juc;

import java.util.concurrent.atomic.AtomicInteger;

public class CASTest
{
    public static AtomicInteger count = new AtomicInteger(0);
    public static void main(String[] args)
    {
        for (int i = 0; i < 20; i++)
        {
            new Thread(() ->
            {
                for (int j = 0; j < 20; j++)
                {


                    count.incrementAndGet();
                }
            }).start();
        }
        try
        {
            Thread.sleep(2000);
        }
        catch (InterruptedException e)
        {
            e.printStackTrace();
        }
        System.out.println(count);
    }
}
